<template>
  <div>
    <div class="personal-info-box">
      <div class="triangle"></div>
      <div class="jersey-number">{{season}}</div>
      <div class="player-name">中国足球超级联赛</div>
      <div class="player-img">
        <img  src="../assets/image/leagueLogo/cls.png" alt="">
      </div>
      <div class="bottom-tab-bar">
        <div class="personal-info-el-tabs">
          <el-tabs v-model="activeName">
            <el-tab-pane label="赛程轮次" name="scheduleRound"/>
            <el-tab-pane label="积分榜" name="scoreRank"/>
            <el-tab-pane label="射手榜" name="topScorerList"/>
          </el-tabs>
        </div>
      </div>
    </div>
    <div>
      <Schedule @changeLeagueSeason="changeLeagueSeason" v-show="activeName==='scheduleRound'"/>
      <Scoreboard v-show="activeName==='scoreRank'"/>
      <PlayerRank v-show="activeName==='topScorerList'"/>
    </div>
  </div>
</template>

<script>
  import Schedule from "../components/csl/schedule/Schedule";
  import Scoreboard from "../components/csl/board/Scoreboard";
  import PlayerRank from "../components/csl/playerRank/PlayerRank";
  export default {
    name: "Leagues",
    components:{
      Scoreboard,
      Schedule,
      PlayerRank
    },
    data(){
      return {
        season:2019,
        activeName:'scheduleRound',
      }
    },
    methods:{
      //下拉框宽度
      setMinWidthEmpty (val) {
        // 无数据的情况下，给请选择提示设置最小宽度
        let domEmpty = document.getElementsByClassName('el-select-dropdown');
        if(domEmpty.length > 0) {
          domEmpty[0].style['min-width'] = val.srcElement.clientWidth + 2 + 'px'
        }
      },
      //子传父,选择赛季之后 页面最上面 中超背后的年份 改变
      changeLeagueSeason(newSeasonId){
        this.season = newSeasonId
      }
    },
    created() {

    },
    //路由进入之前
    beforeRouteEnter(to,form,next){
      const {leagueId} = to.params;
      //初次进入路由没有this，必须在next中用vm充当this
      next(vm=>{
        vm.leagueName= leagueId;
      });
    },
    //路由更新之后
    beforeRouteUpdate(to,form,next){
      //先写next，再执行操作
      next();
      const {leagueId} = to.params;
      this.leagueName = leagueId;
    },
  }
</script>

<style scoped >
  .personal-info-box {
    position: relative;
    background-color: #F1F6F9;
    width:  1440px;
    height: 294px;
    margin: auto;
  }

  .triangle {
    border-style: solid;
    border-width: 29px;
    border-color: #65D6C1 transparent  transparent  #65D6C1;
    width: 0;
    height: 0;
  }

  .jersey-number {
    position: absolute;
    top: 0;
    left: 35%;
    text-align: center;
    font-size: 150px;
    font-weight: bold;
    width: 30%;
    height: 237px;
    line-height: 237px;
    color: rgba(158, 158, 158, 0.3);
    /*background-color: #B500FE;*/
  }

  .player-name {
    position: absolute;
    top: 32%;
    left: 30%;
    text-align: center;
    font-size: 66px;
    width: 40%;
    letter-spacing: 5px;
    height: 70px;
    line-height: 70px;
    color: rgba(22, 199, 154, 0.7);
    font-weight: bold;
    /*background-color: navy;*/
  }

  .player-position {
    position: absolute;
    top: 60%;
    left: 35%;
    text-align: center;
    font-size: 30px;
    width: 30%;
    height: 40px;
    line-height: 40px;
    font-weight: bold;
    /*background-color: #9a6e3a;*/
  }

  .player-basic-info {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: absolute;
    top: 5%;
    right: 2%;
    width: 240px;
    height: 220px;
    font-weight: bold;
    /*background-color: #990055;*/
  }

  .player-info-item {
    display: flex;
    justify-content: space-between;
    flex-direction: row;
    line-height: 30px;
    text-align: left;
    width: 100%;
    height: 30px;
    /*background-color: #9a6e3a;*/
  }

  .player-info-item > div:nth-child(1) {
    width: 80px;
    /*background-color: red;*/
  }

  .player-info-item > div:nth-child(2) {
    line-height: 30px;
    width: 140px;
    height: 30px;
    /*background-color: blue;*/
  }

  .player-country,.player-club {
    display: flex;
  }

  .national-flag {
    width: 30px;
    height: 30px;
  }

  .club-logo {
    width: 30px;
    height: 30px;
  }

  .player-img {
    position: absolute;
    top: 47%;
    left: 1%;
    /*width: 250px;*/
    /*height: 250px;*/
    /*border-radius: 50%;*/
    z-index: 2;
    /*overflow: hidden;*/
  }

  .player-img > img {
    margin-top: 13px;
    width: 277px;
    /*height: 225px;*/
    /*border-radius: 50%;*/
  }

  .bottom-tab-bar {
    position: absolute;
    bottom: 0;
    text-align: center;
    font-size: 30px;
    width: 100%;
    height: 57px;
    background-color: #194568;
  }

  .personal-info-el-tabs {
    /*font-size: 30px;*/
    margin-top: 5px;
    margin-left: 300px;
    /*margin-right: 25px;*/
  }
  .personal-info-el-tabs /deep/ .el-tabs__item {
    color: white;
    font-size: 20px;
    font-weight: bold;
  }
  .personal-info-el-tabs /deep/ .el-tabs__nav-wrap::after {
    height: 0;
  }
  .personal-info-el-tabs /deep/ .el-tabs__active-bar {
    height: 3px;
    background-color: #65D6C1;
  }
  .personal-info-el-tabs /deep/ .el-tabs__item:hover {
    color: #65D6C1;
  }
  .personal-info-el-tabs /deep/ .el-tabs__item.is-active {
    color: #65D6C1;
  }
</style>